package org.wanho.rent.dao.impl;

import org.wanho.jdbc.util.JdbcTemplate;
import org.wanho.jdbc.util.RowMapper;
import org.wanho.rent.dao.SysuserDao;
import org.wanho.rent.entity.SysUser;
import org.wanho.rent.factory.ObjectFactory;
import org.wanho.rent.mapper.SysuserMapper;

public class SysuserDaoImpl implements SysuserDao{
	
	private JdbcTemplate<SysUser> jt = (JdbcTemplate<SysUser>) ObjectFactory.getObject("jt");
	private RowMapper<SysUser> rm = new SysuserMapper();
	
	@Override
	public SysUser selectByLoginname(String loginname) {
		String sql = new StringBuffer()
			.append(" select ")
			.append(" 	id,username,loginname,loginpassword ")
			.append(" from ")
			.append(" 	sysuser ")
			.append(" where ")
			.append(" 	loginname=? ")
			.toString();
		return jt.queryForObject(sql, rm, loginname);
	}

}
